package com.store.app.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.store.app.R;
import com.store.app.bean.MembersDTBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Ben
 * on 2016/8/29 0029.\
 */
public class MemberDTAdapter extends BaseAdapter {
    private List<MembersDTBean> dtBeen=new ArrayList<>();
    private Context context;

    public MemberDTAdapter(List<MembersDTBean> dtBeen,Context context){
        this.context =context;
        this.dtBeen =dtBeen;
    }



    @Override
    public int getCount() {
        return dtBeen.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_member_dta, null);


            viewHolder.acon = (TextView) convertView.findViewById(R.id.tv_acount);
            viewHolder.name = (TextView) convertView.findViewById(R.id.tv_nick_name);
            viewHolder.tvGold = (TextView) convertView.findViewById(R.id.tv_gold);
            viewHolder.tvCash = (TextView) convertView.findViewById(R.id.tv_num);

            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.acon.setText(dtBeen.get(position).mobile);
        viewHolder.name.setText(dtBeen.get(position).nick_name);
        viewHolder.tvCash.setText(dtBeen.get(position).cash_balance);
        viewHolder.tvGold.setText(dtBeen.get(position).gold);
        return convertView;
    }

    class ViewHolder {
        private TextView acon;
        private TextView tvCash;
        private TextView tvGold;
        private TextView name;
    }
}
